{% extends 'base.html' %}

{% block content %}
  <form action="." method="GET">
    <label for="q">Product Name: </label>
    <input type="text" name="q" value="{{ query|escape }}">
    <input type="submit" value="Search">
  </form>

  {% if query %}
    <h2>Results for "{{ query|escape }}":</h2>

    {% if results %}
      <ul>
      {% for product in results %}
        <li><a href="/products{{product.slug}}">{{ product|escape }}</a></l1>
      {% endfor %}
      </ul>
    {% else %}
      <p>No products found</p>
    {% endif %}
  {% endif %}


{% endblock %}

